<?php
//------------Forms generated from formsWiz
include_once("../../globals.php");
include_once($GLOBALS["srcdir"]."/api.inc");
function soap_report( $pid, $encounter, $cols, $id) {
 $cols = 1; // force always 1 column
 $count = 0;
 $data = formFetch("form_soap", $id);
 if ($data) {
  print "<table><tr>";
  foreach($data as $key => $value) {
      
   if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") {
    continue;
   }
   if ($value == "on") {
    $value = "yes";
   }
   switch($key){
       case 'subjective':
           $key2 = 'Enfermedad Actual';
           break;
       case 'objective':
           $key2 = 'Examen F&iacutesico';
           break;
       case 'assessment':
           $key2 = 'Plan de manejo';
           break;
	   case 'motivo':
           $key2 = 'Motivo de la Consulta';
           break;
		   
		case 'concepto':
           $key2 = 'Concepto';
           break;
		case 'conducta':
           $key2 = 'Conducta';
           break;
   }
   $key=ucwords(str_replace("_"," ",$key));
	if($key2=='Conducta'){
		$result = sqlFetchArray(
		sqlStatement("select * from form_soap f where f.pid='$pid' and f.id='$id'")
		); 
		/*echo "<pre>";
		print_r($result);
		echo "</pre>";*/
		
		$cres2 = sqlFetchArray(sqlStatement("SELECT * FROM `list_options` WHERE list_id = 'Conducta_a_seguir' AND seq='". $result{"conducta"} . "' order by seq asc"));
		print "<td><span class=bold> Conducta a seguir: </span><span class=text>". $cres2{"title"} ."</span></td>";
   }else{
	print "<td><span class=bold>" . $key2 . ": </span><span class=text>$value</span></td>";
   }
   
   $count++;
   if ($count == $cols) {
    $count = 0;
    print "</tr><tr>\n";
   }
  }
 }
 print "</tr></table>";
}
?>
